from django.views import generic
from django.core.handlers.wsgi import WSGIRequest
from django.http import HttpResponse, JsonResponse

from . import utils


class ScraperBitrixHomeView(generic.View):

    def get(self, request: WSGIRequest) -> HttpResponse:
        return utils.ScraperBitrixHome().get_necessary_information(request)


class ScraperBitrixSettingsView(generic.View):

    def post(self, request: WSGIRequest) -> JsonResponse:
        return utils.ScraperBitrixSettings().perform_necessary_action(request)


class ScraperBitrixStartupView(generic.View):

    def get(self, request: WSGIRequest) -> JsonResponse:
        return utils.ScraperBitrixStartup().get_necessary_information(request)

    def post(self, request: WSGIRequest) -> JsonResponse:
        return utils.ScraperBitrixStartup().perform_necessary_action(request)
